home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / comm / phmkr17a.zip / SETUP.MS_ / SETUP.bin
Text File  |  1996-06-15  |  21KB  |  725 lines

  1. '**************************************************************************
  2. '*                       FoxPro/Windows Installation
  3. '**************************************************************************
  4.  
  5. '$INCLUDE 'setup.inc'
  6.  
  7. DECLARE FUNCTION GetProgMgrGrps LIB "mscuistf.dll" AS INTEGER
  8. DECLARE FUNCTION QuietConfigUpdate LIB "mscuistf.dll" AS INTEGER
  9. DECLARE FUNCTION CanFindConfigSys LIB "mscuistf.dll" AS INTEGER
  10. DECLARE FUNCTION CalcListSize LIB "mscuistf.dll" AS LONG
  11. DECLARE FUNCTION WindowWidth LIB "mscuistf.dll" (iWind%) AS INTEGER
  12. DECLARE FUNCTION WindowHeight LIB "mscuistf.dll" (iWind%) AS INTEGER
  13. DECLARE FUNCTION InsertFile LIB "mscuistf.dll" (szDestFile$, szSourceFile$) AS INTEGER
  14. DECLARE FUNCTION Spawn LIB "mscuistf.dll" (szCommand$, szDir$) AS INTEGER
  15.  
  16. ''Local functions and procedures.
  17. DECLARE SUB AddToPM
  18. DECLARE SUB ConfirmQuit
  19. DECLARE SUB CreateCopyList
  20. DECLARE SUB DoRestart
  21. DECLARE SUB Install
  22. DECLARE SUB GetPathInfo
  23. DECLARE SUB GetPathGrpInfo
  24. DECLARE SUB GetUserDefaults
  25. DECLARE SUB UpdateConfig
  26. DECLARE SUB UpdateINI
  27.  
  28. DECLARE FUNCTION ConfirmNameOrg () AS STRING
  29. DECLARE FUNCTION EnoughSpace () AS STRING
  30. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  31. DECLARE FUNCTION SectionSize (szSection$) AS INTEGER
  32. DECLARE FUNCTION WarnBadPath () AS STRING
  33.  
  34. ''Dialog ID's
  35. CONST ASKQUIT           = 200           ''Is the user certain they want to quit?
  36. CONST BADINI            = 4500            ''We couldn't read setup.ini.
  37. CONST BADMODE           = 2100          ''We aren't in Enhanced mode.
  38. CONST BADNAME           = 7700          ''The user has to enter a name.
  39. CONST BADPATH           = 6400          ''The target directory can't be written to.
  40. CONST BADPATH_FORCED    = 6200            ''The target directory is bad, but the user can't change it.
  41. CONST BILLBOARD         = 20000         ''Used to hold billboard bitmaps.
  42. CONST CANTADDRSC        = 4700            ''Can't add resource to foxprow.exe
  43. CONST CANTFIND          = 3900          ''Can't find config.sys.
  44. CONST CANTQUIT          = 2300          ''Couldn't exit Windows.
  45. CONST CANTSPAWN            = 6500            ''Couldn't run optional stuff.
  46. CONST CANTUPDATE        = 3500          ''Coulsn't update config.sys.
  47. CONST CANTWRITETOFP        = 5200            ''FoxPro is in a read only directory.
  48. CONST CONFIRMINFO       = 7300          ''Is the name and organization ok?
  49. CONST DESTPATH          = 5300            ''Get target directory without a group.
  50. CONST DESTPATHGROUP     = 5400          ''Get target directory and group.
  51. CONST DISKFULL          = 5500          ''Not enough disk space is available.
  52. CONST DISKFULL_BACK        = 6100            ''Not enough disk space is available, change path?
  53. CONST DISKWINFULL       = 5600          ''Not enough space on Windows drive.
  54. CONST EDITCONFIG        = 2700          ''Review changes to config.sys
  55. CONST EDITMODE          = 3800          ''Select method of updating config.sys
  56. CONST EDITOK            = 3700          ''We updated config.sys
  57. CONST EXITFAILURE       = 5700            ''We are quiting due to an error.
  58. CONST EXITNOICON        = 2800          ''We installed, but don't have an icon.
  59. CONST EXITQUIT          = 5800            ''We were forced to quit by the user.
  60. CONST EXITSUCCESS       = 5900            ''We have successfully finished.
  61. CONST GETNAMEORG        = 1300          ''Get the user's name and organization.
  62. CONST NOPROD            = 5100            ''Path to foxprow.exe is bad.
  63. CONST NOT386            = 1800          ''Machine is less than a 386SX.
  64. CONST OPTIONS            = 800            ''Components to install.
  65. CONST REINSTALL         = 2000          ''Copy disincentive message.
  66. CONST RESTARTWIN        = 2200          ''Warn before restarting windows.
  67. CONST WAITADDRSC        = 4900            ''Wait while adding FOXT.EXE.
  68. CONST WAITINI           = 6600          ''Wait while updating INI files.
  69. CONST WAITSPACE         = 6700          ''Wait while getting free disk space.
  70.  
  71. CONST MSGRAPH            = 1
  72. CONST APPLICATION        = 2
  73. CONST SYSFILES            = 3
  74.  
  75. CONST CUIDLL$           = "mscuistf.dll"                ''The .DLL containing our dialog routines.
  76. CONST DEFAULT_TITLE$    = "Setup"
  77. CONST LOGO              = 2                             ''Logo Bitmap ID.
  78. CONST LASTRESORT$       = "Setup was damaged.  Please try a new set of disks."
  79. CONST LASTTITLE$        = "Setup Error"
  80. CONST MINFILES%         = 40
  81. CONST NO                = 0
  82. CONST NOGROUP$          = "- NONE -"                    ''Group name which means don't create a group.
  83. CONST README$            = "README.TXT"
  84. CONST READ_DESC$        = "Read Me"
  85. CONST YES                = 1
  86.  
  87. GLOBAL DEST$            ''Default destination directory.
  88. GLOBAL fGRAPH%            ''Flag indicating if the graph runtime is to be installed.
  89. GLOBAL fWIN31%          ''Flag indicating if we are running under 3.1 or later.
  90. GLOBAL GROUP$           ''Default destination group.
  91. GLOBAL MODE$            ''Determines whether we let the user change path and/or group.
  92. GLOBAL MSDEST$            ''MS Graph runtime location.
  93. GLOBAL PM_EXE$            ''Exe to add to the PM.
  94. GLOBAL PM_DESCRIPT$        ''Label for the PM.
  95. GLOBAL QUIT_PROG$        ''Program to execute when we quit.
  96. GLOBAL SRCDIR$          ''Location of install files.
  97. GLOBAL szInf$            ''Location of the inf file.
  98. GLOBAL WINDIR$            ''Windows directory.
  99. GLOBAL WINSYSDIR$       ''Windows system directory.
  100.  
  101. INIT:
  102.     ON ERROR GOTO QUIT
  103.  
  104.     DEST$           = "c:\foxprow"
  105.     DLG%            = 400
  106.     fGRAPH%            = NO
  107.     GROUP$            = "FoxPro for Windows"
  108.     MODE$            = "NO"
  109.     MSDEST$         = MakePath(GetWindowsDir(), "msapps")
  110.     PMGROUPS%       = 0
  111.     QUIT_PROG$        = ""
  112.     SRCDIR$         = GetSymbolValue("STF_SRCDIR")
  113.     WINDIR$            = GetWindowsDir()
  114.     WINSYSDIR$        = GetWindowsSysDir()
  115.  
  116.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  117.     IF szInf$ = "" THEN
  118.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  119.     END IF
  120.     ReadInfFile szInf$
  121.  
  122.     fGRAPH%    = DoesIniSectionExist(szInf$, "MSGraph")
  123.     SetSymbolValue "NoGroup", NOGROUP$
  124.  
  125. ''    SetBitmap CUIDLL$, LOGO
  126.  
  127. ''
  128. '' Make sure we have at least a 386SX.
  129. ''
  130. IF GetProcessorType() < 3 THEN
  131.     PROCESSOR:
  132.     sz$ = UIStartDlg(CUIDLL$, NOT386, "FInfo0DlgProc", 0, "")
  133.     IF sz$ = "EXIT" OR sz$ = "CANCEL" THEN
  134.         ConfirmQuit
  135.         GOTO PROCESSOR
  136.     END IF
  137.     UIPop 1
  138.     END
  139. END IF
  140.  
  141. ''
  142. '' Warn the user if we are not in Enhanced mode.
  143. ''
  144. IF GetWindowsMode() < 2 THEN
  145.     ENHANCED:
  146.         sz$ = UIStartDlg(CUIDLL$, BADMODE, "FInfoDlgProc", 0, "")
  147.         IF sz$ = "EXIT" OR sz$ = "CANCEL" THEN
  148.             ConfirmQuit
  149.             GOTO ENHANCED
  150.         ELSE
  151.             UIPop 1
  152.         END IF
  153. END IF
  154.  
  155. ''
  156. '' Get the user's choices for window titles, default directories, etc.
  157. ''
  158. GetUserDefaults
  159.  
  160. ''
  161. '' For our own use, see if we are running on a version later than 3.0.
  162. ''
  163. fWIN31% = YES
  164. IF GetWindowsMajorVersion() < 3 THEN
  165.     fWIN31% = NO
  166. ELSEIF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() = 0 THEN
  167.     fWIN31% = NO
  168. END IF
  169.  
  170. ''
  171. '' Get a list of PM groups if possible.
  172. ''
  173. IF fWIN31% = YES THEN
  174.     PMGROUPS% = GetProgMgrGrps()
  175. END IF
  176.  
  177. ''
  178. '' Have the user specify where to put the product.  (Including the group if
  179. '' we can get the info.)
  180. ''
  181. GETTARGETINFO:
  182.     IF MODE$ <> "YES" THEN
  183.         IF fWIN31% = NO OR GetListLength("ListItemsIn") = 0 OR MODE$ = "GROUP ONLY" THEN
  184.             GetPathInfo
  185.         ELSE
  186.             GetPathGrpInfo
  187.         END IF
  188.     ELSE
  189.         IF IsDirWritable(DEST$) = NO THEN
  190.             sz$ = UIStartDlg(CUIDLL$, BADPATH_FORCED, "FInfoDlgProc", 0, "")
  191.             ERROR STFERR
  192.         END IF
  193.     END IF
  194.  
  195. IF EnoughSpace() = "BACK" THEN
  196.     GOTO GETTARGETINFO
  197. END IF
  198.  
  199. ''
  200. '' Try to gaurantee that FILES are at least a minimum value.
  201. ''
  202. UpdateConfig
  203.  
  204. Install
  205.  
  206. IF ERR = STFQUIT THEN
  207.     DLG% = EXITQUIT
  208. ELSE
  209.     DLG% = EXITSUCCESS
  210. END IF
  211. GOTO QUITL1
  212.  
  213. QUIT:
  214.     UIPopAll
  215.     IF ERR = STFPROGMAN THEN
  216.         DLG% = EXITNOICON
  217.     ELSEIF ERR = STFQUIT THEN
  218.         DLG% = EXITQUIT
  219.     ELSE
  220.         DLG% = EXITFAILURE
  221.     END IF
  222.  
  223. QUITL1:
  224.     ON ERROR GOTO TOAST
  225.  
  226.     IF DLG% = EXITSUCCESS AND LEN(QUIT_PROG$) <> 0 THEN
  227.         QUIT_PROG$ = MakePath(DEST$, QUIT_PROG$)
  228.         IF (MID$(DEST$, LEN(DEST$), 1) = "\") THEN
  229.             y$ = MID$(DEST$, 1, LEN(DEST$)-1)
  230.         ELSE
  231.             y$ = DEST$
  232.         END IF
  233.         x% = Spawn(QUIT_PROG$, y$)
  234.         IF x% <> 0 THEN
  235.             SetSymbolValue "EXE_NAME", QUIT_PROG$
  236.             sz$ = UIStartDlg(CUIDLL$, DLG%, "FVarStringDlgProc", 0, "")
  237.             UIPop 1
  238.             DLG% = EXITFAILURE
  239.         ELSE
  240.             UIPop ALL
  241.             END
  242.         END IF
  243.     END IF
  244.  
  245. QUITL2:
  246.     IF DLG% <> EXITSUCCESS OR LE